from p2p.config import HOST


class ApiApproveTrust:
    def __init__(self,session):
        self.session=session
        self.__url_approve=HOST+"/member/realname/approveRealname"
        self.__url_approve_status=HOST+"/member/member/getapprove"
        self.__url_trust=HOST+"/trust/trust/register"
        self.__url_img_code=HOST+"/common/public/verifycode/{}"
        self.__url_recharge=HOST+"/trust/trust/recharge"


    # 1.认证接口 封装
    def api_approve(self,card_id="350102199003072237"):
        data={
            "realname":"华仔",
            "card_id":card_id
        }
        return self.session.post(url=self.__url_approve,data=data,files={"x":"y"})

    # 2.查询认证状态接口 封装
    def api_approve_status(self):
        return self.session.post(url=self.__url_approve_status)

    # 3.开户接口 封装
    def api_trust(self):
        return self.session.post(url=self.__url_trust)

    # 4.获取图片验证码接口 封装
    def api_img_code(self,random):
        return self.session.get(url=self.__url_img_code)

    # 5.充值接口 封装
    def api_recharge(self,valicode):
        data={
            "paymentType":"chinapnrTrust",
            "amount":"1000",
            "formStr":"reForm",
            "valicode":valicode
        }
        return self.session.post(url=self.__url_recharge,data=data)

